import request from "@/utils/request";
import type { AxiosPromise } from "axios";
import type {
  ChatTitleProps,
  HistoryDetailQuery,
  HistoryDetailVO,
  HistoryQuery,
  HistoryVO,
  PromptsQuery,
  PromptsVO,
} from "./types";

/**
 * 获取验证码
 */
export function getPrompts(query?: PromptsQuery): AxiosPromise<PromptsVO[]> {
  return request({
    url: "/aicase/prompts/list",
    method: "get",
    params: query,
  });
}

/**
 * 添加对话标题获取对话id
 * @param data
 */
export const addChatTitle = (data: ChatTitleProps) => {
  return request({
    url: "/aicase/title",
    method: "post",
    data,
  });
};

/**
 * 查询历史记录列表
 * @param params
 */
export const historyList = (
  params: HistoryQuery
): AxiosPromise<HistoryVO[]> => {
  return request({
    url: "/aicase/title/list",
    method: "get",
    params,
  });
};

/**
 * 查询历史对话列表
 * @param id
 */
export const getTitleDetail = (params: HistoryDetailQuery): AxiosPromise<HistoryDetailVO[]> => {
  return request({
    url: "/aicase/content/list",
    method: "get",
    params,
  });
};
